//
// Created by void on 24-1-8.
//
#include "Channel.h"
struct Channel* channelInit(int fd, int events, handleFunc readFunc,
        handleFunc writeFunc, handleFunc destroyFunc, void* arg) {
    struct Channel* channel = (struct Channel*)malloc(sizeof (struct Channel));
    channel->arg = arg;
    channel->fd = fd;
    channel->events = events;
    channel->readCallback = readFunc;
    channel->writeCallback = writeFunc;
    channel->destroyCallback = destroyFunc;
    return channel;
}

void writeEventEnable(struct Channel *channel, bool flag) {
    flag ? channel->events |= WriteEvent : channel->events & (~WriteEvent);
}

bool isWriteEventEnable(struct Channel *channel) {
    return channel->events & WriteEvent;
}



